<!doctype html>
<html>
<head>
    <meta charset="utf8">
    <title>合作</title>
    <meta name="keywords" content="个人博客,一起学习,一起成长" />
    <meta name="description" content="在成长的路上不断的学习，进步" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/base.css" rel="stylesheet">
    <link href="css/index.css" rel="stylesheet">
    <link href="css/m.css" rel="stylesheet">
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery.easyfader.min.js"></script>
    <script src="js/scrollReveal.js"></script>
    <script src="js/common.js"></script>
    <!--[if lt IE 9]>
    <script src="js/modernizr.js"></script>
    <style>



    </style>
    <![endif]-->
</head>
<body>
<header>
    <!--menu begin-->

    <?php include 'menu.php';?>
    <?php include 'mnav.php';?>
    <!--menu end-->
    <!--mnav begin-->


    <!--mnav end-->
</header>
<div class="pagebg ab"> </div>
<div class="container">
    <h1 class="t_nav"><a  class="n2">意见</a></h1>
    <div class="">

        <div class="aa">
            <label>内容：</label>
            <textarea name="content" rows="6" maxlength="100" id="saytext"   placeholder="输入内容，字数为100字以内" style="width: 100%;margin-top: 10px " ></textarea>
        </div>
        <div style="text-align:center">
            <button type="button" style="height: 25px;width: 50px" onclick="checkClick()">确定
        </div>

    </div>

</div>
<footer>
    <p>Design by <a href="" target="_blank">个人博客</a> <a href="/">蜀ICP备11002373号-1</a></p>
</footer>
<a href="#" class="cd-top">Top</a>
<script>
    function checkClick() {
        var sid = "<?= $sid?>";
        var username = "<?= $username?>";
        var saytext= document.getElementById("saytext").value;
        if(saytext.length == 0){
            alert("内容不能为空")
            return false;
        }
        if (saytext.length>100){
            alert("亲，你输入的内容太多啦，100个字内哦")
            return false;
        }
        token = "<?php echo \Yii::$app->request->getCsrfToken()?>",
            $.ajax({

                url: "index.php?r=post/addsugg",
                data: {saytext:saytext,_csrf: token,sid:sid,username:username},
                type: "post",
                dataType : 'json',
                success: function (msg) {
                    if (msg.status ==200){
                        alert(msg.msg)
                        document.getElementById("saytext").value= '';
                    }else {
                        alert(msg.msg)
                    }

                }


            });
    }


</script>
</body>
</html>

